package com.tian.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * {@code @description:}  短信类型枚举类
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024-12-08 19:17
 * {@code @version:} 1.0
 */
@Getter
public enum MessageTypeEnum {
    CODE(0, "登录验证码", "您的登录验证码为：code，请在5分钟内完成验证。如非本人操作，请忽略本短信。【Java后端技术全栈】"),
    ;

    private final Integer type;
    private final String desc;
    private final String content;

    private static final Map<Integer, MessageTypeEnum> CODE_MAP = new HashMap<>();
    static {
        for (MessageTypeEnum typeEnum : MessageTypeEnum.values()) {
            CODE_MAP.put(typeEnum.getType(), typeEnum);
        }
    }
    MessageTypeEnum(Integer type, String desc, String content) {
        this.type = type;
        this.desc = desc;
        this.content = content;
    }

    public static MessageTypeEnum getMessageTypeEnum(Integer type) {
        return CODE_MAP.get(type);
    }
}
